package com.fbty.mt.action.admin;

import java.util.HashMap;
import java.util.Map;

import com.fbty.base.action.BaseAction;
import com.fbty.base.domain.Page;
import com.fbty.mt.service.IpService;
import com.fbty.mt.service.UserIpInfoService;

public class AutoChangeAction extends BaseAction {
	private String type="";
	
	private String country="";
	
	private String region="";
	
	private String city="";
	
	private int pageNo=1;
	
	private int pageSize=20;
	
	private Page page;
	
	private IpService ipInfoService;
	private UserIpInfoService userIpInfoService;
	
	private boolean flag;
	
	private Integer upid;
	private Integer id;
	public String execute(){
		Map<String,Object> parms=new HashMap<String,Object>();
		parms.put("region", "%"+region+"%");
		parms.put("type","".equals(type)?"%"+type+"%":type);
		parms.put("country", "%"+country+"%");
		parms.put("city", "%"+city+"%");
		page = ipInfoService.pageOnlyIpInfos(pageNo, pageSize, flag, parms);
		
		return "success";
	}
	public String change(){
		try {
			userIpInfoService.modifyAutoChange(upid,id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "success";
	}
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getRegion() {
		return region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	public Page getPage() {
		return page;
	}

	public void setIpInfoService(IpService ipInfoService) {
		this.ipInfoService = ipInfoService;
	}

	public int getUpid() {
		return upid;
	}

	public void setUpid(int upid) {
		this.upid = upid;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public void setUserIpInfoService(UserIpInfoService userIpInfoService) {
		this.userIpInfoService = userIpInfoService;
	}
	
	
}
